{% extends "base_mobile.html" %}
{% load humanize %}

{% block title %}
CMAT 21 - {{competitor.first_name|lower|capfirst}} {{competitor.last_name|lower|capfirst}}
{% endblock title %}

{% block header %}
  <meta property='og:title' content='{{competitor.first_name|lower|capfirst}} {{competitor.last_name|lower|capfirst}} - CMAT 21 Scoreboard' />
  <meta property='og:description' content='{{competitor.first_name|lower|capfirst}} {{competitor.last_name|lower|capfirst}} is a competitor participating in the 20th Chinese Martial Arts Tournament held at UC Berkeley.  {% if competitor.gender.code == "M"%}He{% else %}She{%endif%} placed {% for event in completed_events %}{% if forloop.last and not forloop.first%}and {%endif%}{{event.placing.place|ordinal}} in {{event.event.event_type.name}}{% if forloop.last %}.{% else %}, {% endif %}{% endfor %}' />
  <meta property='og:type' content='profile' />
  <meta property='og:profile:first_name' content='{{competitor.first_name}}' />
  <meta property='og:profile:last_name' content='{{competitor.last_name}}' />
{% endblock header %}

{% block heading %}
  {{competitor.first_name|lower|capfirst}} {{competitor.last_name|lower|capfirst}}
{% endblock heading %}

{% block comp_li %}class="ui-btn-active"{% endblock %}

{% block content %}
<ul data-role="listview">
  <li data-theme="a">
    {{competitor.level.name}} - {{competitor.gender.name}} - {{competitor.age_group.name}}
  </li>
  <li data-role="list-divider"><h2>Events</h2></li>
  {% for event in completed_events %}
    <li data-theme="e"><a href="/event/{{event.event.shortcode}}">
      <h3 class="ul-li-heading">
        {{event.event.shortcode}} - 
      {% if event.placing %}
        {{event.placing.place|ordinal}} place
      {% else %}
        (N/A)
      {% endif %}
      </h3>
      <p class="ul-li-aside"><strong>
        {{event.event.level.name}} - 
        {{event.event.gender.name}} - 
        {{event.event.age_group.name}}
      </strong></p>
      <p class="ul-li-aside">{{event.event.event_type.name}}</p>
      <p class="ui-li-count">{{event.event.num_competitors}}</p>
    </a>
  {% endfor %}
  {% for event, meta in unfinished_events %}
  <li><a href="/event/{{event.shortcode}}">
    <h3 class="ul-li-heading">
      {{event.shortcode}} - 
      {% if meta.order == 0 %}
        Current
      {% else %}
        {% if meta.order == 1 %}
          Next
        {% else %}
          {{meta.order|ordinal}}
        {% endif %} 
      {% endif %}
      event in Ring {{event.ring.number}}
    </h3>
    <p class="ul-li-aside"><strong>{{event.level.name}} - {{event.gender.name}} - {{event.age_group.name}}</strong></p>
    <p class="ul-li-aside">{{event.event_type.name}}</p>
    <p class="ui-li-count">{{event.num_competitors}}</p>
  </a></li>
  {% endfor %}
</ul>
{% endblock content %}
